package ptaTest3;

import java.util.*;
class Rectangle extends Shape{
	private int width;
	private int length;
	
	public Rectangle(int width,int length)
	{
		this.width=width;
		this.length=length;
	}
	public double getPerimeter()
	{
		double Perimeter=2*width+2*length;
		return Perimeter;
	}
	public double getArea()
	{
		double Area=width*length;
		return Area;
	}
	public String toString()
	{
		return "[Rectangle [width="+width+", length="+length+"]";
	}
}
class Circle extends Shape
{
	private int radius;
	public Circle(int radius)
	{
		this.radius=radius;
	}
	public String toString()
	{
		return "[Circle [radius="+radius+"]";
	}
	public double getArea()
	{
		double Area=(int)Math.PI*radius*radius;
		return Area;
	}
	public double getPerimeter()
	{
		double Perimeter=2*(int)Math.PI*radius;
		return Perimeter;
	}
}
abstract class Shape
{
	public final double PI=3.14;
	public abstract double getPerimeter();
	public abstract double getArea();
}
public class Test354 {

	public static double sumAllArea(Shape[] shape) 
	{
		double area = 0;
		for (int i = 0; i < shape.length; i++) 
		{
			area= shape[i].getArea()+area;
		}
		return area;
	}
	public static double sumAllPerimeter(Shape[] shape) 
	{
		double perimeter = 0;
		for (int i = 0; i < shape.length; i++) 
		{
			perimeter= shape[i].getPerimeter()+perimeter;
		}
		return perimeter;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Shape[] shape = new Shape[n];
		for (int i = 0; i < n; i++) {
			String s = in.next();
			if (s.equals("rect")) 
			{
				int a=in.nextInt();
				int b=in.nextInt();
				shape[i] = new Rectangle(a,b);
			} 
			else 
			{
				int a=in.nextInt();
				shape[i] = new Circle(a);
			}
		}
		System.out.println(sumAllPerimeter(shape));
		System.out.println(sumAllArea(shape));
		System.out.println(Arrays.toString(shape));
		for (int i = 0;i < n;i++) 
		{
			System.out.println(shape[i].getClass() + "," +shape[i].getClass().getSuperclass());
		}
		in.close();
	}
}